import sys
import time
import datetime
import platform
def find_password(ID):
    for i in range(len(IDs)):
        if(IDs[i] == ID):
            return i
    return -1
def check_time(start):
    now = time.perf_counter()
    if(now - start >= 3600):
        return True
    return False
f = open("data.txt", "r")
sys.stdin = f
IDs = []
passwords = []
cnt = 1
for line in f:
    s = ""
    n = len(line)
    n -= 1
    for i in range(n):
        s += line[i]
    if(cnt % 2 == 1):
        IDs.append(s)
    else:
        passwords.append(s)
    cnt += 1
# print(IDs)
f.close()
sys.stdin = sys.__stdin__
ID = input("请输入准考证号：")
password = input("请输入密码：")
if(ID not in IDs):
    print("准考证号不存在！！！")
    exit(0)
idx = find_password(ID)
pwd = passwords[idx]
if(pwd != password):
    print("密码错误！！！")
    exit(0)
print("登录成功")
print("请选择考试科目：")
print("1:数据结构")
print("2:数学分析")
print("3:算法分析与设计")
subject = ["", "数据结构", "数学分析", "算法分析与设计"]
op = int(input())
print("开始考试，考试科目为", subject[op], "限时1小时")
start = time.perf_counter()

filename = subject[op] + ".txt"
f = open(filename, "r")
sys.stdin = f
cnt = 0
ans = [""]
for line in f:
    print(line)
    s = input("请输入答案")
    if(check_time(start)):
        print("考试结束，系统自动交卷")
        exit(0)
    ans.append(s)

